/*
 * Copyright 2016 balena.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.modal-content {
  background-color: $palette-theme-light-background;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  height: auto;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: baseline;
  font-size: 12px;
  color: $palette-theme-light-soft-foreground;
  padding: 11px 20px;
  flex-grow: 0;
}

.modal-title {
  font-size: inherit;
  flex-grow: 1;
}

.modal-body {
  flex-grow: 1;
  color: $palette-theme-light-foreground;
  padding: 20px;
  max-height: 250px;
  overflow: auto;

  a {
    color: $palette-theme-primary-background;
  }

  > p {
    white-space: pre-line;
  }

  > p:last-child {
    margin-bottom: 0;
  }
}

.modal-menu {
  display: flex;

  > * {
    flex-basis: auto;
  }
}

// UI Bootstrap adds the `.modal-open` class to the <body>
// element and sets its right padding to the width of the
// window, causing the window content to overflow and get
// pushed to the bottom.
// The `!important` flag is needed since UI Bootstrap inlines
// the styles programmatically to the element.
.modal-open {
  padding-right: 0 !important;
}

// Disable modal opacity
.modal-backdrop.in {
  opacity: 0;
}

.modal-footer {
  flex-grow: 0;
  border: 0;
  text-align: center;
}

.modal {

  // Center the modal using Flexbox so we can
  // freely use any height.
  display: flex !important;
  justify-content: center;
  align-items: center;

  .button[disabled] {
    background-color: $palette-theme-light-disabled-background;
    color: $palette-theme-light-disabled-foreground;
  }
}

.modal-dialog {
  margin: 0;
  position: initial;
}
